package com.xht.transaction.service;

import com.xht.transaction.data.UserData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户服务层
 */
@Service
public class UserService {

    @Autowired
    private UserData userData;

    /**
     * 声明式事务注解
     * @param userName
     * @return
     */
    @Transactional
    public Boolean addUser(String userName){
        Boolean result = userData.insert(userName);

        int a = 10 / 0;

        return result;
    }

}
